/* SSH2 Library - Messages.h
 * Copyright (c) 2009 The Consola Authors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 */
#ifndef _SSH2_MESSAGES_H_
#define _SSH2_MESSAGES_H_

/************************************************************************
 * This file contains enumeration tables for specific ssh-type messages.
 ************************************************************************/

/**
 * SSH_Msg. Message table that contains message id numbers for specific SSH protocols.
 *  These protocols include the SSH Transport Layer, SSH USer Authentication, and the SSH Connection protocols.
 */
enum SSH_Msg {
    SSH_MSG_DISCONNECT                      = 1,    /* SSH Transport */
    SSH_MSG_IGNORE,                                 /* SSH Transport */
    SSH_MSG_UNIMPLEMENTED,                          /* SSH Transport */
    SSH_MSG_DEBUG,                                  /* SSH Transport */
    SSH_MSG_SERVICE_REQUEST,                        /* SSH Transport */
    SSH_MSG_SERVICE_ACCEPT,                         /* SSH Transport */
    SSH_MSG_KEXINIT                         = 20,   /* SSH User Authentication */
    SSH_MSG_NEWKEYS,                                /* SSH User Authentication */
    SSH_MSG_USERAUTH_REQUEST                = 50,   /* SSH User Authentication */
    SSH_MSG_USERAUTH_FAILURE,                       /* SSH User Authentication */
    SSH_MSG_USERAUTH_SUCCESS,                       /* SSH User Authentication */
    SSH_MSG_USERAUTH_BANNER,                        /* SSH User Authentication */
    SSH_MSG_GLOBAL_REQUEST                  = 80,   /* SSH Connection */
    SSH_MSG_REQUEST_SUCCESS,                        /* SSH Connection */
    SSH_MSG_REQUEST_FAILURE,                        /* SSH Connection */
    SSH_MSG_CHANNEL_OPEN                    = 90,   /* SSH Connection */
    SSH_MSG_CHANNEL_OPEN_CONFIRMATION,              /* SSH Connection */
    SSH_MSG_CHANNEL_OPEN_FAILURE,                   /* SSH Connection */
    SSH_MSG_CHANNEL_WINDOW_ADJUST,                  /* SSH Connection */
    SSH_MSG_CHANNEL_DATA,                           /* SSH Connection */
    SSH_MSG_CHANNEL_EXTENDED_DATA,                  /* SSH Connection */
    SSH_MSG_CHANNEL_EOF,                            /* SSH Connection */
    SSH_MSG_CHANNEL_CLOSE,                          /* SSH Connection */
    SSH_MSG_CHANNEL_REQUEST,                        /* SSH Connection */
    SSH_MSG_CHANNEL_SUCCESS,                        /* SSH Connection */
    SSH_MSG_CHANNEL_FAILURE                         /* SSH Connection */
};

/************************************************************************
 * According to RFC4250, all of the reason code values for the tables below
 * are uint32 values. 
 ************************************************************************/

/**
 * SSH_MsgDisconnect. Specifies the initial assignments of "SSH_MSG_DISCONNECT."
 *  Symbolic Name = Reason Code
 */
enum SSH_MsgDisconnect {
    SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT  = 1,
    SSH_DISCONNECT_PROTOCOL_ERROR,
    SSH_DISCONNECT_KEY_EXCHANGE_FAILED,
    SSH_DISCONNECT_RESERVED,
    SSH_DISCONNECT_MAC_ERROR,
    SSH_DISCONNECT_COMPRESSION_ERROR,
    SSH_DISCONNECT_SERVICE_NOT_AVAILABLE,
    SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED,
    SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE,
    SSH_DISCONNECT_CONNECTION_LOST,
    SSH_DISCONNECT_BY_APPLICATION,
    SSH_DISCONNECT_TOO_MANY_CONNECTIONS,
    SSH_DISCONNECT_AUTH_CANCELLED_BY_USER,
    SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE,
    SSH_DISCONNECT_ILLEGAL_USER_NAME
};

/**
 * SSH_MsgOpen. Specifies the initial assignments of "SSH_OPEN."
 *  Symbolic Name = Reason Code
 */
enum SSH_MsgOpen {
    SSH_OPEN_ADMINISTRATIVELY_PROHIBITED    = 1,
    SSH_OPEN_CONNECT_FAILED,
    SSH_OPEN_UNKNOWN_CHANNEL_TYPE,
    SSH_OPEN_RESOURCE_SHORTAGE
};

#define SSH_EXTENDED_DATA_STDERR    1

/**
 * SSH_MsgDH. Specifies message numbers for the Diffie-Hellman Group Key Exchange (SSH) protocol.
 *
 */
enum SSH_MsgDH {
    SSH_MSG_KEX_DH_GEX_REQUEST_OLD  = 30,
    SSH_MSG_KEX_DH_GEX_GROUP,
    SSH_MSG_KEX_DH_GEX_INIT,
    SSH_MSG_KEX_DH_GEX_REPLY,
    SSH_MSG_KEX_DH_GEX_REQUEST
};
 
#endif /* _SSH2_MESSAGES_H_ */
